package com.tydic.mysql2kafka.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;

/**
 * @author chenwk
 * @version 1.0.0
 * @ClassName KafkaProducer
 * @Description KafkaProducer
 * @createTime 2019年11月25日 11:27
 */
@Service
public class KafkaProducer {

    @Value("${binlog.kafka-topic}")
    private String topic;

    @Autowired
    private KafkaTemplate<String,Object> kafkaTemplate;

    public boolean sendMsg(String message){
        return kafkaTemplate.send(topic,message).isDone();
    }
}
